﻿'*******************************************************************************************
'* Copyright Brügmann Software GmbH, Papenburg
'* Author: Björn Kremer
'* Contact: codeplex<at>patorg.de
'* 
'* VB.CMIS is a VB.NET implementation of the Content Management Interoperability Services (CMIS) standard
'*
'* This file is part of VB.CMIS.
'* 
'* VB.CMIS is free software: you can redistribute it and/or modify
'* it under the terms of the GNU Lesser General Public License as published by
'* the Free Software Foundation, either version 3 of the License, or
'* (at your option) any later version.
'* 
'* VB.CMIS is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'* GNU Lesser General Public License for more details.
'* 
'* You should have received a copy of the GNU Lesser General Public License
'* along with VB.CMIS. If not, see <http://www.gnu.org/licenses/>.
'*******************************************************************************************
Imports System
Imports System.Runtime.Serialization
Imports System.Xml.Serialization

Namespace ServiceDocument

   <XmlRoot("capabilities", Namespace:=CmisNamespaceConstants.Cmis)> _
   Public Class RepositoryCapabilities
      Implements IXmlSerializable


#Region "Navigation Capabilities"

      Public Property GetDescendants() As Boolean

      Public Property GetFolderTree() As Boolean

#End Region

#Region "Object Capabilities"

      Public Property ContentStreamUpdatability() As CapabilityContentStreamUpdates

      Public Enum CapabilityContentStreamUpdates

         <EnumMember(Value:="anytime")> _
         Anytime

         <EnumMember(Value:="pwconly")> _
         PwcOnly

         <EnumMember(Value:="none")> _
         None
      End Enum

      Public Property Changes() As CapabilityChanges

      Public Enum CapabilityChanges

         <EnumMember(Value:="none")> _
         None

         <EnumMember(Value:="objectidsonly")> _
         ObjectIdsOnly

         <EnumMember(Value:="properties")> _
         Properties

         <EnumMember(Value:="all")> _
         All
      End Enum

      Public Property Renditions() As CapabilityRendition

      Public Enum CapabilityRendition

         <EnumMember(Value:="none")> _
         None


         <EnumMember(Value:="read")> _
         Read
      End Enum



#End Region

#Region "Filing Capabilities"

      Public Property Multifiling() As Boolean

      Public Property Unfiling() As Boolean

      Public Property VersionSpecificFiling() As Boolean


#End Region

#Region "Versioning Capabilities"

      Public Property PwcUpdatable() As Boolean

      Public Property PwcSearchable() As Boolean

      Public Property AllVersionsSearchable() As Boolean

#End Region

#Region "Query Capabilities"

      Public Property Query() As CapabilityQuery

      Public Enum CapabilityQuery

         <EnumMember(Value:="none")> _
         None

         <EnumMember(Value:="metadataonly")> _
         MetadataOnly

         <EnumMember(Value:="fulltextonly")> _
         FulltextOnly

         <EnumMember(Value:="bothseparate")> _
         BothSeparate

         <EnumMember(Value:="bothcombined")> _
         BothCombined
      End Enum



      Public Property Join() As CapabilityJoin

      Public Enum CapabilityJoin

         <EnumMember(Value:="none")> _
         None

         <EnumMember(Value:="inneronly")> _
         InnerOnly

         <EnumMember(Value:="innerandouter")> _
         InnerAndOuter
      End Enum

#End Region

#Region "ACL Capabilities"
      Public Property Acl() As CapabilityAcl

      Public Enum CapabilityAcl

         <EnumMember(Value:="none")> _
         None

         <EnumMember(Value:="discover")> _
         Discover

         <EnumMember(Value:="manage")> _
         Manage
      End Enum
#End Region

      Public Function GetSchema() As System.Xml.Schema.XmlSchema Implements System.Xml.Serialization.IXmlSerializable.GetSchema
         Return Nothing
      End Function

      Public Sub ReadXml(reader As System.Xml.XmlReader) Implements System.Xml.Serialization.IXmlSerializable.ReadXml

      End Sub

      Public Sub WriteXml(writer As System.Xml.XmlWriter) Implements System.Xml.Serialization.IXmlSerializable.WriteXml
         writer.WriteElementString("capabilityACL", CmisNamespaceConstants.Cmis, Common.GetDataMemberValueFromEnum(Acl, GetType(CapabilityAcl)))
         writer.WriteElementString("capabilityAllVersionsSearchable", CmisNamespaceConstants.Cmis, AllVersionsSearchable.ToString.ToLowerInvariant)
         writer.WriteElementString("capabilityChanges", CmisNamespaceConstants.Cmis, Common.GetDataMemberValueFromEnum(Changes, GetType(CapabilityChanges)))
         writer.WriteElementString("capabilityContentStreamUpdatability", CmisNamespaceConstants.Cmis, Common.GetDataMemberValueFromEnum(ContentStreamUpdatability, GetType(CapabilityContentStreamUpdates)))
         writer.WriteElementString("capabilityGetDescendants", CmisNamespaceConstants.Cmis, GetDescendants.ToString.ToLowerInvariant)
         writer.WriteElementString("capabilityGetFolderTree", CmisNamespaceConstants.Cmis, GetFolderTree.ToString.ToLowerInvariant)
         writer.WriteElementString("capabilityMultifiling", CmisNamespaceConstants.Cmis, Multifiling.ToString.ToLowerInvariant)
         writer.WriteElementString("capabilityPWCSearchable", CmisNamespaceConstants.Cmis, PwcSearchable.ToString.ToLowerInvariant)
         writer.WriteElementString("capabilityPWCUpdatable", CmisNamespaceConstants.Cmis, PwcUpdatable.ToString.ToLowerInvariant)
         writer.WriteElementString("capabilityQuery", CmisNamespaceConstants.Cmis, Common.GetDataMemberValueFromEnum(Query, GetType(CapabilityQuery)))
         writer.WriteElementString("capabilityRenditions", CmisNamespaceConstants.Cmis, Common.GetDataMemberValueFromEnum(Renditions, GetType(CapabilityRendition)))
         writer.WriteElementString("capabilityUnfiling", CmisNamespaceConstants.Cmis, Unfiling.ToString.ToLowerInvariant)
         writer.WriteElementString("capabilityVersionSpecificFiling", CmisNamespaceConstants.Cmis, VersionSpecificFiling.ToString.ToLowerInvariant)
         writer.WriteElementString("capabilityJoin", CmisNamespaceConstants.Cmis, Common.GetDataMemberValueFromEnum(Join, GetType(CapabilityJoin)))
      End Sub
   End Class

End Namespace